---
title: Logs
slug: /logging
---

import Icon from "@site/src/components/icon";
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

Langflow produces logs for individual flows and the Langflow application itself using the [structlog](https://www.structlog.org) library for logging.

The default, primary logfile is named `langflow.log`.

Log files are stored in JSON format with structured metadata.

## Log storage

Langflow logs are stored in the config directory specified in the `LANGFLOW_CONFIG_DIR` environment variable.
The default config directory location depends on your operating system and installation method:

- **Langflow Desktop**:

    - **macOS**: `/Users/<username>/Library/Logs/com.LangflowDesktop`
    - **Windows**: `C:\Users\<username>\AppData\Local\com.LangflowDesktop\logs`

- **OSS Langflow**:

    - **macOS with `uv pip install`**: `/Users/<username>/Library/Caches/langflow`
    - **Linux with `uv pip install`**: `/home/<username>/.cache/langflow`
    - **Windows/WSL with `uv pip install`**: `C:\Users\<username>\AppData\Local\langflow\langflow\Cache`
    - **macOS/Windows/Linux/WSL with `git clone`**: `<path_to_clone>/src/backend/base/langflow/`

To customize log storage locations and behaviors, set the following [Langflow environment variables](/environment-variables) in your Langflow `.env` file, and then start Langflow with `uv run langflow run --env-file .env`:

| Variable | Format | Default | Description |
|----------|--------|---------|-------------|
| `LANGFLOW_CONFIG_DIR` | String | Varies | Set the Langflow configuration directory where files and logs are stored. Default path depends on your installation, as described in the preceding list. |
| `LANGFLOW_LOG_LEVEL` | String | `ERROR` | Sets the log level as one of `DEBUG`, `ERROR`, `INFO`, `WARNING`, and `CRITICAL`. For example, `LANGFLOW_LOG_LEVEL=DEBUG`. |
| `LANGFLOW_LOG_FILE` | String | Not set | Sets the log file storage location if you want to use a non-default location. For example, `LANGFLOW_LOG_FILE=path/to/logfile.log`. If not set, logs are written to stdout. |
| `LANGFLOW_LOG_ENV` | String | `default` | This variable is the primary log format controller. `container`: JSON format for Docker/structured logging. `container_csv`: Key-value format for data analysis. `default` or unset: Uses `LANGFLOW_PRETTY_LOGS` to determine format. |
| `LANGFLOW_PRETTY_LOGS` | Boolean | `True` | This variable controls log output format when `LANGFLOW_LOG_ENV=default` or unset. When `true`, uses structlog's [ConsoleRenderer](https://www.structlog.org/en/stable/console-output.html). When `false`, outputs logs in JSON format.  |
| `LANGFLOW_LOG_FORMAT` | String | Not set | Switch between key-value format and console format. Set to `key_value` for key-value format or `console` to use structlog's [ConsoleRenderer](https://www.structlog.org/en/stable/console-output.html). This variable only works when `LANGFLOW_LOG_ENV=default` and `LANGFLOW_PRETTY_LOGS=true`. |
| `LANGFLOW_LOG_ROTATION` | String | `1 day` | Controls when the log file is rotated, either based on time or file size. For time-based rotation, set to `1 day`, `12 hours`, or `1 week`. For size-based rotation, set to `10 MB` or `1 GB`. To disable rotation, set to `None`. If disabled, log files grow without limit. |
| `LANGFLOW_ENABLE_LOG_RETRIEVAL` | Boolean | `False` | Enables retrieval of logs from your Langflow instance with [Logs endpoints](/api-logs). |
| `LANGFLOW_LOG_RETRIEVER_BUFFER_SIZE` | Integer | `10000` | Set the buffer size for log retrieval if `LANGFLOW_ENABLE_LOG_RETRIEVAL=True`. Must be greater than `0` for log retrieval to function. |

## View logs in real-time

To monitor Langflow logs as they are generated, you can follow the log file:

1. Change to your [Langflow config directory](#log-storage):

    <Tabs groupId="cd-command">
    <TabItem value="macOS" label="macOS" default>

    ```bash
    cd /Users/**USERNAME**/Library/Caches/langflow
    ```

    </TabItem>
    <TabItem value="Windows" label="Windows">

    ```cmd
    cd C:\Users\**USERNAME**\AppData\Local\com.LangflowDesktop\logs
    ```

    </TabItem>
    </Tabs>

2. Tail the main log file:

    <Tabs groupId="tail-command">
    <TabItem value="macOS" label="macOS" default>

    ```bash
    tail -f langflow.log
    ```

    </TabItem>
    <TabItem value="Windows" label="Windows">

    ```cmd
    Get-Content -Wait -Path langflow.log
    ```

    </TabItem>
    </Tabs>

    If you don't see new log entries, check that Langflow is running, and perform some actions to generate logs events. You can also check the terminal where you started Langflow to see if logs are being printed there.

## Flow and component logs

After you run a flow, you can inspect the logs for the each component and flow run.
For example, you can inspect `Message` objects ingested and generated by [Input and Output components](/components-io).

### View flow logs

In the visual editor, click **Logs** to view logs for the entire flow:

![Logs pane](/img/logs.png)

Then, click the cells in the **inputs** and **outputs** columns to inspect the `Message` objects.
For example, the following `Message` data could be the output from a **Chat Input** component:

```text
    "messages": [
    {
        "message": "What's the recommended way to install Docker on Mac M1?",
        "sender": "User",
        "sender_name": "User",
        "session_id": "Session Apr 21, 17:37:04",
        "stream_url": null,
        "component_id": "ChatInput-4WKag",
        "files": [],
        "type": "text"
    }
    ],
```

In the case of Input/Output components, the original input might not be structured as a `Message` object.
For example, a language model component can pass a raw text response to a **Chat Output** component that is then transformed into a `Message` object.

You can find `.log` files for flows at your Langflow installation's log storage location.
For filepaths, see [Log storage](#log-storage).

### View chat logs

In the **Playground**, you can inspect the chat history for each chat session.
For more information, see [View chat history](/concepts-playground#view-chat-history).

### View output from a single component

When debugging issues with the format or content of a flow's output, it can help to inspect each component's output to determine where data is being lost or malformed.

To view the output produced by a single component during the most recent run, click <Icon name="TextSearch" aria-hidden="true"/> **Inspect output** on the component in the visual editor.

## Access Langflow Desktop logs {#desktop-logs}

If you encounter issues with Langflow Desktop, you might need to access startup logs for debugging.
Follow the steps for your operating system.

<Tabs>
<TabItem value="macos" label="macOS">

1. Open Terminal and run:
   ```bash
   cd ~/Library/Logs/com.LangflowDesktop
   ```

2. To open the folder and view the log files, run the command:
   ```bash
   open .
   ```

3. Locate the `langflow.log` file.

</TabItem>
<TabItem value="windows" label="Windows">

1. Open the Command Prompt (CMD), and then run the following command:

   ```cmd
   cd %LOCALAPPDATA%\com.LangflowDesktop\cache
   ```

2. Open the folder and view the log files:

   ```cmd
   start .
   ```

3. Locate the `langflow.log` file.

</TabItem>
</Tabs>

You can use the log file to investigate the issue on your own, add context to a [GitHub Issue](/contributing-github-issues), or send it to [support](/luna-for-langflow) for debugging assistance.

The log file is only created when Langflow Desktop runs. If you don't see a log file, try starting Langflow Desktop first, then check for the log file.

## See also

* [Logs endpoints](/api-logs)
* [Memory management options](/memory)
* [Configure an external PostgreSQL database](/configuration-custom-database)